package com.auntvt.timo.jpax.core.quick.interfaces;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.List;

/**
 * 容器接口，用于操作JPA原生的Specification复杂查询对象
 *
 * @author 小懒虫 <auntvt@163.com>
 * @date 2021/7/31
 */
public interface SpecificationContainer<T> {

    /**
     * 容器回调函数
     *
     * @param root       must not be {@literal null}.
     * @param query      must not be {@literal null}.
     * @param cb         must not be {@literal null}.
     * @param predicates predicate条件列表
     */
    void callback(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder cb, List<Predicate> predicates);
}
